class Solution {
public:
    double myPow(double x, int n) { // long long 防-2^31变成正数溢出
        return n < 0 ? 1 / _myPow(x, -(long long)n) : _myPow(x, n);
    }
 
    double _myPow(double x, long long n)
    {
        if(n == 0)
            return 1;
        double tmp = myPow(x, n / 2);
        return n % 2 == 0 ? tmp*tmp : tmp*tmp*x;
    }
};